.class public abstract Lcom/netease/util/task/BaseDataAsyncTask;
.super Lcom/netease/util/task/NeteaseAsyncTask;
.source "BaseDataAsyncTask.java"


# annotations
.annotation system Ldalvik/annotation/MemberClasses;
    value = {
        Lcom/netease/util/task/BaseDataAsyncTask$DataAsyncCallback;
    }
.end annotation

.annotation system Ldalvik/annotation/Signature;
    value = {
        "<Params:",
        "Ljava/lang/Object;",
        "Progress:",
        "Ljava/lang/Object;",
        "Result:",
        "Ljava/lang/Object;",
        ">",
        "Lcom/netease/util/task/NeteaseAsyncTask",
        "<TParams;TProgress;TResult;>;"
    }
.end annotation


# static fields
.field protected static final CMD_CALLBACK_CANCEL:I = 0x0

.field protected static final CMD_CALLBACK_POST_EXECUTE:I = 0x3

.field protected static final CMD_CALLBACK_PRE_EXECUTE:I = 0x2

.field protected static final CMD_CALLBACK_UPDATE:I = 0x1


# instance fields
.field private mCallback:Ljava/lang/ref/WeakReference;
    .annotation system Ldalvik/annotation/Signature;
        value = {
            "Ljava/lang/ref/WeakReference",
            "<",
            "Lcom/netease/util/task/BaseDataAsyncTask$DataAsyncCallback;",
            ">;"
        }
    .end annotation
.end field

.field protected mContext:Landroid/content/Context;

.field private mHttpClient:Lcom/netease/util/http/AndroidHttpClient;

.field protected mWhatTask:I


# direct methods
.method protected constructor <init>(Landroid/content/Context;ILcom/netease/util/task/BaseDataAsyncTask$DataAsyncCallback;)V
    .locals 1
    .parameter "context"
    .parameter "what"
    .parameter

    .prologue
    .line 47
    .local p0, this:Lcom/netease/util/task/BaseDataAsyncTask;,"Lcom/netease/util/task/BaseDataAsyncTask<TParams;TProgress;TResult;>;"
    .local p3, callback:Lcom/netease/util/task/BaseDataAsyncTask$DataAsyncCallback;,"Lcom/netease/util/task/BaseDataAsyncTask$DataAsyncCallback;"
    invoke-direct {p0}, Lcom/netease/util/task/NeteaseAsyncTask;-><init>()V

    .line 48
    invoke-virtual {p1}, Landroid/content/Context;->getApplicationContext()Landroid/content/Context;

    move-result-object v0

    iput-object v0, p0, Lcom/netease/util/task/BaseDataAsyncTask;->mContext:Landroid/content/Context;

    .line 49
    iput p2, p0, Lcom/netease/util/task/BaseDataAsyncTask;->mWhatTask:I

    .line 50
    new-instance v0, Ljava/lang/ref/WeakReference;

    invoke-direct {v0, p3}, Ljava/lang/ref/WeakReference;-><init>(Ljava/lang/Object;)V

    iput-object v0, p0, Lcom/netease/util/task/BaseDataAsyncTask;->mCallback:Ljava/lang/ref/WeakReference;

    .line 51
    return-void
.end method


# virtual methods
.method protected callback(ILjava/lang/Object;)V
    .locals 2
    .parameter "cmd"
    .parameter "o"

    .prologue
    .line 129
    .local p0, this:Lcom/netease/util/task/BaseDataAsyncTask;,"Lcom/netease/util/task/BaseDataAsyncTask<TParams;TProgress;TResult;>;"
    iget-object v1, p0, Lcom/netease/util/task/BaseDataAsyncTask;->mCallback:Ljava/lang/ref/WeakReference;

    if-nez v1, :cond_1

    const/4 v0, 0x0

    .line 130
    .local v0, callback:Lcom/netease/util/task/BaseDataAsyncTask$DataAsyncCallback;,"Lcom/netease/util/task/BaseDataAsyncTask$DataAsyncCallback;"
    :goto_0
    if-eqz v0, :cond_0

    .line 131
    packed-switch p1, :pswitch_data_0

    .line 148
    :cond_0
    :goto_1
    return-void

    .line 129
    .end local v0           #callback:Lcom/netease/util/task/BaseDataAsyncTask$DataAsyncCallback;,"Lcom/netease/util/task/BaseDataAsyncTask$DataAsyncCallback;"
    :cond_1
    iget-object v1, p0, Lcom/netease/util/task/BaseDataAsyncTask;->mCallback:Ljava/lang/ref/WeakReference;

    invoke-virtual {v1}, Ljava/lang/ref/WeakReference;->get()Ljava/lang/Object;

    move-result-object v1

    check-cast v1, Lcom/netease/util/task/BaseDataAsyncTask$DataAsyncCallback;

    move-object v0, v1

    goto :goto_0

    .line 133
    .restart local v0       #callback:Lcom/netease/util/task/BaseDataAsyncTask$DataAsyncCallback;,"Lcom/netease/util/task/BaseDataAsyncTask$DataAsyncCallback;"
    :pswitch_0
    iget v1, p0, Lcom/netease/util/task/BaseDataAsyncTask;->mWhatTask:I

    invoke-interface {v0, v1}, Lcom/netease/util/task/BaseDataAsyncTask$DataAsyncCallback;->onCancelled(I)V

    goto :goto_1

    .line 136
    :pswitch_1
    iget v1, p0, Lcom/netease/util/task/BaseDataAsyncTask;->mWhatTask:I

    invoke-interface {v0, v1, p2}, Lcom/netease/util/task/BaseDataAsyncTask$DataAsyncCallback;->onProgressUpdate(ILjava/lang/Object;)V

    goto :goto_1

    .line 139
    :pswitch_2
    iget v1, p0, Lcom/netease/util/task/BaseDataAsyncTask;->mWhatTask:I

    invoke-interface {v0, v1}, Lcom/netease/util/task/BaseDataAsyncTask$DataAsyncCallback;->onPreExecute(I)V

    goto :goto_1

    .line 142
    :pswitch_3
    iget v1, p0, Lcom/netease/util/task/BaseDataAsyncTask;->mWhatTask:I

    invoke-interface {v0, v1, p2}, Lcom/netease/util/task/BaseDataAsyncTask$DataAsyncCallback;->onPostExecute(ILjava/lang/Object;)V

    goto :goto_1

    .line 131
    nop

    :pswitch_data_0
    .packed-switch 0x0
        :pswitch_0
        :pswitch_1
        :pswitch_2
        :pswitch_3
    .end packed-switch
.end method

.method public cancel(ZZ)V
    .locals 2
    .parameter "mayInterruptIfRunning"
    .parameter "clearCallback"

    .prologue
    .line 107
    .local p0, this:Lcom/netease/util/task/BaseDataAsyncTask;,"Lcom/netease/util/task/BaseDataAsyncTask<TParams;TProgress;TResult;>;"
    monitor-enter p0

    .line 108
    if-eqz p2, :cond_0

    .line 109
    const/4 v0, 0x0

    :try_start_0
    iput-object v0, p0, Lcom/netease/util/task/BaseDataAsyncTask;->mCallback:Ljava/lang/ref/WeakReference;

    .line 112
    :cond_0
    const/4 v0, 0x0

    iput-object v0, p0, Lcom/netease/util/task/BaseDataAsyncTask;->mContext:Landroid/content/Context;

    .line 115
    invoke-virtual {p0}, Lcom/netease/util/task/BaseDataAsyncTask;->getStatus()Lcom/netease/util/task/NeteaseAsyncTask$Status;

    move-result-object v0

    sget-object v1, Lcom/netease/util/task/NeteaseAsyncTask$Status;->FINISHED:Lcom/netease/util/task/NeteaseAsyncTask$Status;

    if-eq v0, v1, :cond_1

    .line 116
    invoke-super {p0, p1}, Lcom/netease/util/task/NeteaseAsyncTask;->cancel(Z)Z

    .line 107
    :cond_1
    monitor-exit p0

    .line 119
    return-void

    .line 107
    :catchall_0
    move-exception v0

    monitor-exit p0
    :try_end_0
    .catchall {:try_start_0 .. :try_end_0} :catchall_0

    throw v0
.end method

.method public closeHttpClient()V
    .locals 1

    .prologue
    .line 92
    .local p0, this:Lcom/netease/util/task/BaseDataAsyncTask;,"Lcom/netease/util/task/BaseDataAsyncTask<TParams;TProgress;TResult;>;"
    monitor-enter p0

    .line 93
    :try_start_0
    iget-object v0, p0, Lcom/netease/util/task/BaseDataAsyncTask;->mHttpClient:Lcom/netease/util/http/AndroidHttpClient;

    if-eqz v0, :cond_0

    .line 94
    iget-object v0, p0, Lcom/netease/util/task/BaseDataAsyncTask;->mHttpClient:Lcom/netease/util/http/AndroidHttpClient;

    invoke-virtual {v0}, Lcom/netease/util/http/AndroidHttpClient;->close()V

    .line 95
    const/4 v0, 0x0

    iput-object v0, p0, Lcom/netease/util/task/BaseDataAsyncTask;->mHttpClient:Lcom/netease/util/http/AndroidHttpClient;

    .line 92
    :cond_0
    monitor-exit p0

    .line 98
    return-void

    .line 92
    :catchall_0
    move-exception v0

    monitor-exit p0
    :try_end_0
    .catchall {:try_start_0 .. :try_end_0} :catchall_0

    throw v0
.end method

.method public getHttpClient()Lcom/netease/util/http/AndroidHttpClient;
    .locals 2
    .annotation system Ldalvik/annotation/Throws;
        value = {
            Ljava/lang/Exception;
        }
    .end annotation

    .prologue
    .line 75
    .local p0, this:Lcom/netease/util/task/BaseDataAsyncTask;,"Lcom/netease/util/task/BaseDataAsyncTask<TParams;TProgress;TResult;>;"
    monitor-enter p0

    .line 76
    :try_start_0
    iget-object v0, p0, Lcom/netease/util/task/BaseDataAsyncTask;->mContext:Landroid/content/Context;

    if-nez v0, :cond_0

    .line 77
    invoke-virtual {p0}, Lcom/netease/util/task/BaseDataAsyncTask;->closeHttpClient()V

    .line 78
    new-instance v0, Ljava/lang/Exception;

    const-string v1, "Task Cancelled!"

    invoke-direct {v0, v1}, Ljava/lang/Exception;-><init>(Ljava/lang/String;)V

    throw v0

    .line 75
    :catchall_0
    move-exception v0

    monitor-exit p0
    :try_end_0
    .catchall {:try_start_0 .. :try_end_0} :catchall_0

    throw v0

    .line 81
    :cond_0
    :try_start_1
    iget-object v0, p0, Lcom/netease/util/task/BaseDataAsyncTask;->mHttpClient:Lcom/netease/util/http/AndroidHttpClient;

    if-nez v0, :cond_1

    .line 82
    iget-object v0, p0, Lcom/netease/util/task/BaseDataAsyncTask;->mContext:Landroid/content/Context;

    invoke-static {v0}, Lcom/netease/util/HttpUtils;->getAndroidHttpClient(Landroid/content/Context;)Lcom/netease/util/http/AndroidHttpClient;

    move-result-object v0

    iput-object v0, p0, Lcom/netease/util/task/BaseDataAsyncTask;->mHttpClient:Lcom/netease/util/http/AndroidHttpClient;

    .line 84
    :cond_1
    iget-object v0, p0, Lcom/netease/util/task/BaseDataAsyncTask;->mHttpClient:Lcom/netease/util/http/AndroidHttpClient;

    monitor-exit p0
    :try_end_1
    .catchall {:try_start_1 .. :try_end_1} :catchall_0

    return-object v0
.end method

.method protected onCancelled()V
    .locals 2

    .prologue
    .line 153
    .local p0, this:Lcom/netease/util/task/BaseDataAsyncTask;,"Lcom/netease/util/task/BaseDataAsyncTask<TParams;TProgress;TResult;>;"
    const/4 v0, 0x0

    const/4 v1, 0x0

    invoke-virtual {p0, v0, v1}, Lcom/netease/util/task/BaseDataAsyncTask;->callback(ILjava/lang/Object;)V

    .line 154
    return-void
.end method

.method protected onPostExecute(Ljava/lang/Object;)V
    .locals 1
    .parameter
    .annotation system Ldalvik/annotation/Signature;
        value = {
            "(TResult;)V"
        }
    .end annotation

    .prologue
    .line 164
    .local p0, this:Lcom/netease/util/task/BaseDataAsyncTask;,"Lcom/netease/util/task/BaseDataAsyncTask<TParams;TProgress;TResult;>;"
    .local p1, result:Ljava/lang/Object;,"TResult;"
    const/4 v0, 0x3

    invoke-virtual {p0, v0, p1}, Lcom/netease/util/task/BaseDataAsyncTask;->callback(ILjava/lang/Object;)V

    .line 165
    return-void
.end method

.method protected onPreExecute()V
    .locals 2

    .prologue
    .line 158
    .local p0, this:Lcom/netease/util/task/BaseDataAsyncTask;,"Lcom/netease/util/task/BaseDataAsyncTask<TParams;TProgress;TResult;>;"
    const/4 v0, 0x2

    const/4 v1, 0x0

    invoke-virtual {p0, v0, v1}, Lcom/netease/util/task/BaseDataAsyncTask;->callback(ILjava/lang/Object;)V

    .line 159
    return-void
.end method

.method protected varargs onProgressUpdate([Ljava/lang/Object;)V
    .locals 1
    .parameter "values"
    .annotation system Ldalvik/annotation/Signature;
        value = {
            "([TProgress;)V"
        }
    .end annotation

    .prologue
    .line 169
    .local p0, this:Lcom/netease/util/task/BaseDataAsyncTask;,"Lcom/netease/util/task/BaseDataAsyncTask<TParams;TProgress;TResult;>;"
    const/4 v0, 0x1

    invoke-virtual {p0, v0, p1}, Lcom/netease/util/task/BaseDataAsyncTask;->callback(ILjava/lang/Object;)V

    .line 170
    return-void
.end method

.method public setCallback(Lcom/netease/util/task/BaseDataAsyncTask$DataAsyncCallback;)V
    .locals 1
    .parameter

    .prologue
    .line 59
    .local p0, this:Lcom/netease/util/task/BaseDataAsyncTask;,"Lcom/netease/util/task/BaseDataAsyncTask<TParams;TProgress;TResult;>;"
    .local p1, callback:Lcom/netease/util/task/BaseDataAsyncTask$DataAsyncCallback;,"Lcom/netease/util/task/BaseDataAsyncTask$DataAsyncCallback;"
    monitor-enter p0

    .line 60
    if-nez p1, :cond_0

    .line 61
    const/4 v0, 0x0

    :try_start_0
    iput-object v0, p0, Lcom/netease/util/task/BaseDataAsyncTask;->mCallback:Ljava/lang/ref/WeakReference;

    .line 59
    :goto_0
    monitor-exit p0

    .line 66
    return-void

    .line 63
    :cond_0
    new-instance v0, Ljava/lang/ref/WeakReference;

    invoke-direct {v0, p1}, Ljava/lang/ref/WeakReference;-><init>(Ljava/lang/Object;)V

    iput-object v0, p0, Lcom/netease/util/task/BaseDataAsyncTask;->mCallback:Ljava/lang/ref/WeakReference;

    goto :goto_0

    .line 59
    :catchall_0
    move-exception v0

    monitor-exit p0
    :try_end_0
    .catchall {:try_start_0 .. :try_end_0} :catchall_0

    throw v0
.end method
